<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="zh-CN">
<th:block th:replace="common/head :: head(text='信息提醒')" />
<style>
  body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
  }
  h1 {
    font-size: 30px;
    text-align: center;
  }
  p {
    font-size: 20px;
    text-align: center;
  }
</style>
<body>
<h1 th:text="${message}" th:style="${code == 'success' ? 'color: green' : 'color: red'}"/>
<p id="countdown"></p>
<p style="display: none" id="url" th:text="${url}"></p>
<p style="display: none" id="tip" th:text="${tip}"></p>

<script>
    let count = 3;
    let countdownElement = document.getElementById("countdown");
    let url = document.getElementById("url").textContent;
    let tip = document.getElementById("tip").textContent;
    countdownElement.textContent = "页面将在" + count + "秒后自动跳转到" + tip +"页面";
    console.log(url)
    let countdown = setInterval(function() {
      count--;
      countdownElement.textContent = "页面将在" + count + "秒后自动跳转到" + tip +"页面";

      if (count === 0) {
        clearInterval(countdown);
        window.location.href = url; // 将链接更改为目标页面的URL
      }
    }, 1000);
</script>
</body>
</html>
